<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
		
	<!-- 
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
                           http://www.springframework.org/schema/beans/spring-beans.xsd
                           http://www.springframework.org/schema/context 
                           http://www.springframework.org/schema/context/spring-context.xsd">
	-->
	
	<!-- Configures the @Controller programming model 
		Ohne diese Zeile gibt Tomcat kein JSON zurück	-->
	<mvc:annotation-driven />
	
	<!-- Define the controllers using annotations -->
    <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/>
    <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>
	
	<!-- Die folgenden beiden Teile wurden ausgelagert, damit der data-access-context für Unit-Tests wiederverwendet werden kann. -->
	
	<!-- ******************* -->
	<!-- Database            -->
	<!-- ******************* -->
	
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
		<property name="driverClass" value="com.mysql.jdbc.Driver" />
		<property name="jdbcUrl" value="jdbc:mysql://mysql.nusshart.com:33106/mfz_prod" />
		<property name="user" value="mfz" />
		<property name="password" value="We-are-So-Cool" />
		<property name="minPoolSize" value="2" />
      	<property name="maxPoolSize" value="4" />
	</bean>

	<!-- ******************* -->
	<!-- Data Access         -->
	<!-- ******************* -->
	
	<import resource="data-access-context.xml" />
	
	<!-- ******************* -->
	<!-- Controllers         -->
	<!-- ******************* -->
	
	<bean id="loginController" class="de.hdu.mfz.ctrl.LoginController">
		<property name="userDAO" ref="userDAO" />
	</bean>
	
	<bean id="routeController" class="de.hdu.mfz.ctrl.RouteController">
		<property name="routeDAO" ref="routeDAO" />
		<property name="userDAO" ref="userDAO" />
		<property name="mitfahrtDAO" ref="mitfahrtDAO" />
		<property name="loginCtrl" ref="loginController" /> 
	</bean>
	
	<bean id="userController" class="de.hdu.mfz.ctrl.UserController">
		<property name="userDAO" ref="userDAO" />
		<property name="routeDAO" ref="routeDAO" />
		<property name="mitfahrtDAO" ref="mitfahrtDAO" />
		<property name="loginCtrl" ref="loginController" /> 
	</bean>
	
	<!-- ******************* -->
	<!-- Views               -->
	<!-- ******************* -->
	<!-- Wir haben keine Views.... -->
</beans>
